package com.ruoyi.iot.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.iot.mapper.IotRegionMapper;
import com.ruoyi.iot.domain.IotRegion;
import com.ruoyi.iot.service.IIotRegionService;

/**
 * 区域Service业务层处理
 *
 * @author rww
 * @date 2023-11-02
 */
@Service
public class IotRegionServiceImpl implements IIotRegionService
{
    @Autowired
    private IotRegionMapper iotRegionMapper;

    /**
     * 查询区域
     *
     * @param id 区域主键
     * @return 区域
     */
    @Override
    public IotRegion selectIotRegionById(Long id)
    {
        return iotRegionMapper.selectIotRegionById(id);
    }

    /**
     * 查询区域列表
     *
     * @param iotRegion 区域
     * @return 区域
     */
    @Override
    public List<IotRegion> selectIotRegionList(IotRegion iotRegion)
    {
        return iotRegionMapper.selectIotRegionList(iotRegion);
    }

    /**
     * 新增区域
     *
     * @param iotRegion 区域
     * @return 结果
     */
    @Override
    public int insertIotRegion(IotRegion iotRegion)
    {
        iotRegion.setId(IdUtil.getSnowflakeNextId());
        iotRegion.setCreateTime(DateUtils.getNowDate());
        return iotRegionMapper.insertIotRegion(iotRegion);
    }

    /**
     * 修改区域
     *
     * @param iotRegion 区域
     * @return 结果
     */
    @Override
    public int updateIotRegion(IotRegion iotRegion)
    {
        return iotRegionMapper.updateIotRegion(iotRegion);
    }

    /**
     * 批量删除区域
     *
     * @param ids 需要删除的区域主键
     * @return 结果
     */
    @Override
    public int deleteIotRegionByIds(Long[] ids)
    {
        return iotRegionMapper.deleteIotRegionByIds(ids);
    }

    /**
     * 删除区域信息
     *
     * @param id 区域主键
     * @return 结果
     */
    @Override
    public int deleteIotRegionById(Long id)
    {
        return iotRegionMapper.deleteIotRegionById(id);
    }
}
